package com.example.software.controller;

import com.example.software.entity.SupportRequest;
import com.example.software.service.SupportService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/support")
@RequiredArgsConstructor
public class SupportController {
    private final SupportService supportService;

    @PostMapping("/requests")
    public SupportRequest createRequest(@RequestBody SupportRequest request) {
        return supportService.createRequest(request);
    }

    @GetMapping("/requests")
    public List<SupportRequest> getAllRequests() {
        return supportService.getAllRequests();
    }

    @PutMapping("/requests/{id}/reply")
    public void updateReply(@PathVariable Long id, 
                           @RequestBody String reply) { // 直接接收字符串
        supportService.updateReply(id, reply);
    }
}